﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MvcXRepairAdmin.Interfaces;
using MvcXRepairAdmin.Repository.SQL;
using MvcXRepairAdmin.ViewModel;
using XRepair.Models;

namespace MvcXRepairAdmin.Services
{
    public class AccountService : IAccountService
    {
        private AccountDAO _accountRepository;

        public AccountService()
        {
            _accountRepository = new AccountDAO();
        }

        public IEnumerable<User> GetAllUsers()
        {
            return _accountRepository.GetAllUsers();
        }

        public bool AddNewUser(User user)
        {
            return _accountRepository.AddNewUser(user);
        }

        public bool DeactivateUser(int userId)
        {
            return _accountRepository.DeactivateUser(userId);
        }

        public bool ReactivateUser(int userId)
        {
            return _accountRepository.ReactivateUser(userId);
        }

        public User GetUserInfoByCredentials(LoginViewModel model)
        {
            return _accountRepository.GetUserInfoByCredentials(model.Username, model.Password);
        }
    }
}
